package cn.kgc.mvc.service.impl;

import cn.kgc.mvc.entity.Student;
import cn.kgc.mvc.mapper.StudentMapper;
import cn.kgc.mvc.service.StudentService;
import cn.kgc.mvc.utils.MapperUtil;

import java.util.List;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/5/4
 * @Description:
 */
public class StudentServiceImpl  implements StudentService {

    private StudentMapper studentMapper = MapperUtil.getMapper(StudentMapper.class);

    @Override
    public List<Student> selectList() {
        List<Student> students =   studentMapper.selectList();
        return students;
    }

    @Override
    public Boolean add(Student student) {
        Integer line=  studentMapper.insertStudent(student);
        return line>0;
    }

    @Override
    public Student getById(Integer id) {

       return studentMapper.getById(id);
    }

    @Override
    public Boolean update(Student student) {

       Integer line =  studentMapper.updateStudent(student);
        return line>0;
    }

    @Override
    public Boolean deleteById(int id) {
         Integer line =  studentMapper.deleteById(id);
        return line>0;
    }
}
